/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.core.repository.mapper;

import info.peigen.hotpot.business.account.core.repository.entity.AccountLogEntity;
import info.peigen.hotpot.business.account.facade.enums.AccountTransCode;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

import java.util.List;

/**
 * <b>(AccountMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/12
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface AccountLogMapper extends AbstractBeetlSqlMapper<AccountLogEntity> {
    @Sql("select * from account_log where account_log_id = ?")
    @Select
    AccountLogEntity findByAccountLogId(String accountLogId);

    @Sql("select * from account_log where trans_log_id = ?")
    @Select
    List<AccountLogEntity> findByTransLogId(String transLogId);

    @Sql("select * from account_log where trade_id = ?")
    @Select
    List<AccountLogEntity> findByTradeId(String tradeId);

    @Sql("select * from account_log where account_id = ?")
    @Select
    List<AccountLogEntity> findByAccountId(String accountId);

    @Sql("select * from account_log where trade_id = ? and trans_code = ? and account_id = ?")
    @Select
    AccountLogEntity findByTradeIdAndTransCodeAndAccountId(String tradeId, AccountTransCode transCode, String accountId);

    @Sql("delete from account_log where account_log_id = ?")
    @Update
    void deleteByAccountLogId(String accountLogId);

    @Sql("delete from account_log where trans_log_id = ?")
    @Update
    void deleteByTransLogId(String transLogId);

    @Sql("delete from account_log where trade_id = ?")
    @Update
    void deleteByTradeId(String tradeId);

    @Sql("delete from account_log where account_id = ?")
    @Update
    void deleteByAccountId(String accountId);
}